package com.huawei.appmarket.service.alarm.control;

import android.content.Context;
import android.os.Bundle;
import com.huawei.appmarket.service.predownload.jobservice.UrgentUpdateJobService;
import com.huawei.appmarket.service.predownload.jobservice.WlanPeriodicJobService;
import com.huawei.appmarket.service.predownload.jobservice.WlanUpdateJobService;
import java.util.ArrayList;
import java.util.List;
import o.cdb;
import o.Logger;
import o.doo;
import o.dpr;
import o.dpx;
import o.dpz;
import o.dqc;
import o.dqe;
import o.dqf;
import o.dqk;
import o.dqn;
import o.edx;
import o.ehp;

public class HiAppPowerConnectChangeService extends BasePowerConnectChangeService {
    public void executePowerConnectTask() {
        Context applicationContext = getApplicationContext();
        ((edx) cdb.ॱ(edx.class)).ˋ();
        ˋ(applicationContext);
        WlanPeriodicJobService.schedule();
        UrgentUpdateJobService.schedule();
        if (!ॱ(applicationContext)) {
            WlanUpdateJobService.schedule();
        }
    }

    private void ˋ(Context context) {
        List arrayList = new ArrayList();
        if (doo.ˊ(getApplicationContext())) {
            if (dqe.ˋ()) {
                Logger.ˎ("HiAppPowerConnectChangeService", "match the time to check app upgrade.");
                arrayList.add(dpr.class);
            }
            Logger.ˎ("HiAppPowerConnectChangeService", "execute BaseRecommendContentTask.");
            arrayList.add(dpx.class);
            arrayList.add(ehp.class);
            if (doo.ॱॱ(context) && !doo.ᐝ(context)) {
                arrayList.add(dqn.class);
                arrayList.add(dqc.class);
                arrayList.add(dpz.class);
            }
        }
        arrayList.add(dqk.class);
        arrayList.add(dqf.class);
        Class[] clsArr = (Class[]) arrayList.toArray(new Class[arrayList.size()]);
        Bundle bundle = new Bundle();
        bundle.putInt(RepeatingTaskManager.KEY_PRE_DOWNLOAD_START_TYPE, 14);
        RepeatingTaskManager.execute(getApplicationContext(), bundle, clsArr);
    }

    private boolean ॱ(Context context) {
        boolean ॱॱ = doo.ॱॱ(context);
        boolean ᐝ = doo.ᐝ(context);
        Logger.ˎ("HiAppPowerConnectChangeService", "PowerConnected:[wifiConn:" + ॱॱ + "]-[meteredWifi:" + ᐝ + "]");
        return ॱॱ && !ᐝ;
    }
}
